<?php defined('SYSPATH') OR die('No direct access allowed.'); ?>
<div align="center" class="fixtext_label">
	<h1 class="entry-title"  style="font-size: 13pt">ค้นหาห้องเช่า</h1>
	<a class="fixtext_label" style="font-weight: bold;color:maroon;" href="<?= url::site("find_hongshaw/find_bkkzone") ?>">ห้องเช่าตามเขต</a> | 
	<a class="fixtext_label" style="font-weight: bold;color:maroon;" href="<?= url::site("find_hongshaw/find_university") ?>">ห้องเช่าตามสถานศึกษา</a> | 
	<a class="fixtext_label" style="font-weight: bold;color:maroon;" href="<?= url::site("find_hongshaw/find_province") ?>">ห้องเช่าตามจังหวัด</a> 
</div>
<br>
<div class="box" style="text-align: left;">
<form action="<?=url::base()?>index.php/find_hongshaw/listProvince" enctype="application/x-www-form-urlencoded" method="post">
	<table width="100%" cellspacing="2" cellpadding="0" border="0">
		<tbody>

			<tr>
				<td valign="bottom" height="27"><div align="center" class="fixtext_label"  style="font-size: 13pt">ห้องพักตามจังหวัด</div>
				</td>
			</tr>
			<tr>
				<td><center>
						<select name="province_id" style="width: 50%" >
							<option selected="selected" value="0">---- ทุกจังหวัด ----</option>
							<?php
							foreach ( $provinces as $pv) {
								echo "<option value=\"$pv->id\">$pv->name</option>";
							}?>
						</select>
					</center></td>
			</tr>
			<tr>
				<td><center>
						<select style="width: 50%"  id="price" name="price">
							<option selected="selected" value="0">---- ทุกราคา ----</option>
							<option value="2000">ต่ำกว่า 2,000 บาท</option>
							<option value="3000">2,000-3,000 บาท</option>
							<option value="4000">3,000 บาทขึ้นไป</option>
						</select>
					</center></td>
			</tr>
			<tr>
				<td><center>
						<select name="category_id" style="width: 50%" >
						<option selected="selected" value="0">-- ทุกประเภทห้องเช่า --</option>
						<?php
						foreach ( $categorys as $obj) {
							echo "<option value=\"$obj->id\">$obj->name</option>";
						}?>
						</select>
					</center></td>
			</tr>
			<tr>
				<td><center>
						<input class="form_submit" style="width: 150px;height: 25px;font-family: Tohama;" type="submit" value="ค้นหาห้องเช่า" id="search_province" name="search_province">
					</center></td>
			</tr>
		</tbody>

	</table>
	</form>
</div>
<!-- If find success will be show as below krab -->
<?php if($total_items>0){?>
<table class="fixtext_label" style="width: 100%" border="0" align="center" cellspacing="2">
	<tbody style="width: 100%" >
	<?php
	$mc=0;
	foreach ($hongshaws as $hongshaw) {
		if($mc%2==0){?>
		<tr style="width: 100%">
			<td align="center">
				<table class="product_detail" style="width: 100%;height: 260px;">
					<tr>
						<td valign="top" style="width: 108px;">
							<a href="<?php echo url::base(FALSE).''.$hongshaw->thumbnail?>" >
								<img style="border: 2px solid #000;" src="<?php echo url::base(FALSE).''.$hongshaw->thumbnail?>"/>
							</a>
							<p>ราคา :: &nbsp;<?=$hongshaw->hongshaw_min_price?>&nbsp;&nbsp;บาท</p>
							<p>
								<a href="<?= url::site("detail/find/$hongshaw->id") ?>"  title="ดูเพิ่มเติม..">
							       <?=$hongshaw->hongshaw_name?>
							    </a>
							</p>
						
						</td>
						<td valign="top">
							<p>รายละเอียด&nbsp;::&nbsp;<?=$hongshaw->hongshaw_detail?></p>
						</td>
					</tr>
				</table>
			</td>
			<?php }else{ ?>
			<td align="center">
				<table class="product_detail" style="width: 100%;height: 260px;">
					<tr>
						<td valign="top" style="width: 108px;">
							<a href="<?php echo url::base(FALSE).''.$hongshaw->thumbnail?>" >
								<img style="border: 2px solid #000;" src="<?php echo url::base(FALSE).''.$hongshaw->thumbnail?>"/>
							</a>
							<p>ราคา :: &nbsp;<?=$hongshaw->hongshaw_min_price?>&nbsp;&nbsp;บาท</p>
							<p>
								<a href="<?= url::site("detail/find/$hongshaw->id") ?>"  title="ดูเพิ่มเติม..">
							       <?=$hongshaw->hongshaw_name?>
							    </a>
							</p>
						
						</td>
						<td valign="top">
							<p>รายละเอียด&nbsp;::&nbsp;<?=$hongshaw->hongshaw_detail?></p>
						</td>
						</tr>
				</table>
			</td>
		<tr>
		<?php }
		$mc++;
	}?>
	
	</tbody>
</table>
<table style="width: 100%">
	<tr style="width: 100%">
		<td style="width: 50px">Page :: &nbsp;</td>
		<td align="left"><?=$pagination->render()?></td>
	</tr>
</table>
<?php }?>